﻿using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using QxFramework.Utilities;
using QxFramework.Core;

public class EffectManager : MonoSingleton<EffectManager>
{
    public const string EFFECT_PATH = "Prefabs/Skill/";
    List<SkillBase> _AllEffects = new List<SkillBase>();

    public List<SkillBase> Effects => _AllEffects;
    public void InstantiateSkillEffect(string _path, Transform parent, Vector2 _pos, SkillBase skill)
    {
        GameObject effectGameObject = ResourceManager.Instance.Instantiate(EFFECT_PATH + _path, parent);
        effectGameObject.transform.position = _pos;
        effectGameObject.GetComponent<BulletBase>().Init(skill, _pos);
        
    }
    public void InstantiateSkillEffect(string _path, Transform parent, Vector2 _pos, Vector2 _aim, SkillBase skill)
    {
        GameObject effectGameObject = ResourceManager.Instance.Instantiate(EFFECT_PATH + _path, parent);
        effectGameObject.transform.position = _pos;
        effectGameObject.GetComponent<BulletBase>().Init(skill, _pos, _aim);
    }
    public void RecycleEffect(GameObject gameObject)
    {
        ObjectPool.Recycle(gameObject);
    }
    
}
